3.277 \(\int \frac{A+B \cos (c+d x)}{(a+b \cos (c+d x))^4} \, dx\)

Optimal. Leaf size=237 \[ \frac{\left (2 a^3 A-4 a^2 b B+3 a A b^2-b^3 B\right ) \tan ^{-1}\left (\frac{\sqrt{a-b} \tan \left (\frac{1}{2} (c+d x)\right )}{\sqrt{a+b}}\right )}{d (a-b)^{7/2} (a+b)^{7/2}}-\frac{\left (11 a^2 A b-2 a^3 B-13 a b^2 B+4 A b^3\right ) \sin (c+d x)}{6 d \left (a^2-b^2\right )^3 (a+b \cos (c+d x))}-\frac{\left (-2 a^2 B+5 a A b-3 b^2 B\right ) \sin (c+d x)}{6 d \left (a^2-b^2\right )^2 (a+b \cos (c+d x))^2}-\frac{(A b-a B) \sin (c+d x)}{3 d \left (a^2-b^2\right ) (a+b \cos (c+d x))^3} \]

[Out]

((2*a^3*A + 3*a*A*b^2 - 4*a^2*b*B - b^3*B)*ArcTan[(Sqrt[a - b]*Tan[(c + d*x)/2])/Sqrt[a + b]])/((a - b)^(7/2)*
(a + b)^(7/2)*d) - ((A*b - a*B)*Sin[c + d*x])/(3*(a^2 - b^2)*d*(a + b*Cos[c + d*x])^3) - ((5*a*A*b - 2*a^2*B -
 3*b^2*B)*Sin[c + d*x])/(6*(a^2 - b^2)^2*d*(a + b*Cos[c + d*x])^2) - ((11*a^2*A*b + 4*A*b^3 - 2*a^3*B - 13*a*b
^2*B)*Sin[c + d*x])/(6*(a^2 - b^2)^3*d*(a + b*Cos[c + d*x]))

________________________________________________________________________________________

Rubi [A]  time = 0.477634, antiderivative size = 237, normalized size of antiderivative = 1., number of steps used = 6, number of rules used = 4, integrand size = 23, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.174, Rules used = {2754, 12, 2659, 205} \[ \frac{\left (2 a^3 A-4 a^2 b B+3 a A b^2-b^3 B\right ) \tan ^{-1}\left (\frac{\sqrt{a-b} \tan \left (\frac{1}{2} (c+d x)\right )}{\sqrt{a+b}}\right )}{d (a-b)^{7/2} (a+b)^{7/2}}-\frac{\left (11 a^2 A b-2 a^3 B-13 a b^2 B+4 A b^3\right ) \sin (c+d x)}{6 d \left (a^2-b^2\right )^3 (a+b \cos (c+d x))}-\frac{\left (-2 a^2 B+5 a A b-3 b^2 B\right ) \sin (c+d x)}{6 d \left (a^2-b^2\right )^2 (a+b \cos (c+d x))^2}-\frac{(A b-a B) \sin (c+d x)}{3 d \left (a^2-b^2\right ) (a+b \cos (c+d x))^3} \]

Antiderivative was successfully verified.

[In]

Int[(A + B*Cos[c + d*x])/(a + b*Cos[c + d*x])^4,x]

[Out]

((2*a^3*A + 3*a*A*b^2 - 4*a^2*b*B - b^3*B)*ArcTan[(Sqrt[a - b]*Tan[(c + d*x)/2])/Sqrt[a + b]])/((a - b)^(7/2)*
(a + b)^(7/2)*d) - ((A*b - a*B)*Sin[c + d*x])/(3*(a^2 - b^2)*d*(a + b*Cos[c + d*x])^3) - ((5*a*A*b - 2*a^2*B -
 3*b^2*B)*Sin[c + d*x])/(6*(a^2 - b^2)^2*d*(a + b*Cos[c + d*x])^2) - ((11*a^2*A*b + 4*A*b^3 - 2*a^3*B - 13*a*b
^2*B)*Sin[c + d*x])/(6*(a^2 - b^2)^3*d*(a + b*Cos[c + d*x]))

Rule 2754

Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> -Simp[((
b*c - a*d)*Cos[e + f*x]*(a + b*Sin[e + f*x])^(m + 1))/(f*(m + 1)*(a^2 - b^2)), x] + Dist[1/((m + 1)*(a^2 - b^2
)), Int[(a + b*Sin[e + f*x])^(m + 1)*Simp[(a*c - b*d)*(m + 1) - (b*c - a*d)*(m + 2)*Sin[e + f*x], x], x], x] /
; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 - b^2, 0] && LtQ[m, -1] && IntegerQ[2*m]

Rule 12

Int[(a_)*(u_), x_Symbol] :> Dist[a, Int[u, x], x] /; FreeQ[a, x] &&  !MatchQ[u, (b_)*(v_) /; FreeQ[b, x]]

Rule 2659

Int[((a_) + (b_.)*sin[Pi/2 + (c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> With[{e = FreeFactors[Tan[(c + d*x)/2], x
]}, Dist[(2*e)/d, Subst[Int[1/(a + b + (a - b)*e^2*x^2), x], x, Tan[(c + d*x)/2]/e], x]] /; FreeQ[{a, b, c, d}
, x] && NeQ[a^2 - b^2, 0]

Rule 205

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]*ArcTan[x/Rt[a/b, 2]])/a, x] /; FreeQ[{a, b}, x]
&& PosQ[a/b]

Rubi steps

\begin{align*} \int \frac{A+B \cos (c+d x)}{(a+b \cos (c+d x))^4} \, dx &=-\frac{(A b-a B) \sin (c+d x)}{3 \left (a^2-b^2\right ) d (a+b \cos (c+d x))^3}-\frac{\int \frac{-3 (a A-b B)+2 (A b-a B) \cos (c+d x)}{(a+b \cos (c+d x))^3} \, dx}{3 \left (a^2-b^2\right )}\\ &=-\frac{(A b-a B) \sin (c+d x)}{3 \left (a^2-b^2\right ) d (a+b \cos (c+d x))^3}-\frac{\left (5 a A b-2 a^2 B-3 b^2 B\right ) \sin (c+d x)}{6 \left (a^2-b^2\right )^2 d (a+b \cos (c+d x))^2}+\frac{\int \frac{2 \left (3 a^2 A+2 A b^2-5 a b B\right )-\left (5 a A b-2 a^2 B-3 b^2 B\right ) \cos (c+d x)}{(a+b \cos (c+d x))^2} \, dx}{6 \left (a^2-b^2\right )^2}\\ &=-\frac{(A b-a B) \sin (c+d x)}{3 \left (a^2-b^2\right ) d (a+b \cos (c+d x))^3}-\frac{\left (5 a A b-2 a^2 B-3 b^2 B\right ) \sin (c+d x)}{6 \left (a^2-b^2\right )^2 d (a+b \cos (c+d x))^2}-\frac{\left (11 a^2 A b+4 A b^3-2 a^3 B-13 a b^2 B\right ) \sin (c+d x)}{6 \left (a^2-b^2\right )^3 d (a+b \cos (c+d x))}-\frac{\int -\frac{3 \left (2 a^3 A+3 a A b^2-4 a^2 b B-b^3 B\right )}{a+b \cos (c+d x)} \, dx}{6 \left (a^2-b^2\right )^3}\\ &=-\frac{(A b-a B) \sin (c+d x)}{3 \left (a^2-b^2\right ) d (a+b \cos (c+d x))^3}-\frac{\left (5 a A b-2 a^2 B-3 b^2 B\right ) \sin (c+d x)}{6 \left (a^2-b^2\right )^2 d (a+b \cos (c+d x))^2}-\frac{\left (11 a^2 A b+4 A b^3-2 a^3 B-13 a b^2 B\right ) \sin (c+d x)}{6 \left (a^2-b^2\right )^3 d (a+b \cos (c+d x))}+\frac{\left (2 a^3 A+3 a A b^2-4 a^2 b B-b^3 B\right ) \int \frac{1}{a+b \cos (c+d x)} \, dx}{2 \left (a^2-b^2\right )^3}\\ &=-\frac{(A b-a B) \sin (c+d x)}{3 \left (a^2-b^2\right ) d (a+b \cos (c+d x))^3}-\frac{\left (5 a A b-2 a^2 B-3 b^2 B\right ) \sin (c+d x)}{6 \left (a^2-b^2\right )^2 d (a+b \cos (c+d x))^2}-\frac{\left (11 a^2 A b+4 A b^3-2 a^3 B-13 a b^2 B\right ) \sin (c+d x)}{6 \left (a^2-b^2\right )^3 d (a+b \cos (c+d x))}+\frac{\left (2 a^3 A+3 a A b^2-4 a^2 b B-b^3 B\right ) \operatorname{Subst}\left (\int \frac{1}{a+b+(a-b) x^2} \, dx,x,\tan \left (\frac{1}{2} (c+d x)\right )\right )}{\left (a^2-b^2\right )^3 d}\\ &=\frac{\left (2 a^3 A+3 a A b^2-4 a^2 b B-b^3 B\right ) \tan ^{-1}\left (\frac{\sqrt{a-b} \tan \left (\frac{1}{2} (c+d x)\right )}{\sqrt{a+b}}\right )}{(a-b)^{7/2} (a+b)^{7/2} d}-\frac{(A b-a B) \sin (c+d x)}{3 \left (a^2-b^2\right ) d (a+b \cos (c+d x))^3}-\frac{\left (5 a A b-2 a^2 B-3 b^2 B\right ) \sin (c+d x)}{6 \left (a^2-b^2\right )^2 d (a+b \cos (c+d x))^2}-\frac{\left (11 a^2 A b+4 A b^3-2 a^3 B-13 a b^2 B\right ) \sin (c+d x)}{6 \left (a^2-b^2\right )^3 d (a+b \cos (c+d x))}\\ \end{align*}

Mathematica [A]  time = 2.15806, size = 227, normalized size = 0.96 \[ \frac{\frac{\left (-11 a^2 A b+2 a^3 B+13 a b^2 B-4 A b^3\right ) \sin (c+d x)}{(a-b)^3 (a+b)^3 (a+b \cos (c+d x))}+\frac{\left (2 a^2 B-5 a A b+3 b^2 B\right ) \sin (c+d x)}{(a-b)^2 (a+b)^2 (a+b \cos (c+d x))^2}+\frac{6 \left (2 a^3 A-4 a^2 b B+3 a A b^2-b^3 B\right ) \tanh ^{-1}\left (\frac{(a-b) \tan \left (\frac{1}{2} (c+d x)\right )}{\sqrt{b^2-a^2}}\right )}{\left (b^2-a^2\right )^{7/2}}+\frac{2 (a B-A b) \sin (c+d x)}{(a-b) (a+b) (a+b \cos (c+d x))^3}}{6 d} \]

Antiderivative was successfully verified.

[In]

Integrate[(A + B*Cos[c + d*x])/(a + b*Cos[c + d*x])^4,x]

[Out]

((6*(2*a^3*A + 3*a*A*b^2 - 4*a^2*b*B - b^3*B)*ArcTanh[((a - b)*Tan[(c + d*x)/2])/Sqrt[-a^2 + b^2]])/(-a^2 + b^
2)^(7/2) + (2*(-(A*b) + a*B)*Sin[c + d*x])/((a - b)*(a + b)*(a + b*Cos[c + d*x])^3) + ((-5*a*A*b + 2*a^2*B + 3
*b^2*B)*Sin[c + d*x])/((a - b)^2*(a + b)^2*(a + b*Cos[c + d*x])^2) + ((-11*a^2*A*b - 4*A*b^3 + 2*a^3*B + 13*a*
b^2*B)*Sin[c + d*x])/((a - b)^3*(a + b)^3*(a + b*Cos[c + d*x])))/(6*d)

________________________________________________________________________________________

Maple [B]  time = 0.118, size = 1727, normalized size = 7.3 \begin{align*} \text{result too large to display} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((A+B*cos(d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+a+b)^3/(a+b)/(a^3-3*a^2*b+3*a*b^2-b
^3)*tan(1/2*d*x+1/2*c)*B*b^3+2/d*a^3/(a^6-3*a^4*b^2+3*a^2*b^4-b^6)/((a-b)*(a+b))^(1/2)*arctan(tan(1/2*d*x+1/2*
c)*(a-b)/((a-b)*(a+b))^(1/2))*A+3/d*a*b^2/(a^6-3*a^4*b^2+3*a^2*b^4-b^6)/((a-b)*(a+b))^(1/2)*arctan(tan(1/2*d*x
+1/2*c)*(a-b)/((a-b)*(a+b))^(1/2))*A-4/d*a^2*b/(a^6-3*a^4*b^2+3*a^2*b^4-b^6)/((a-b)*(a+b))^(1/2)*arctan(tan(1/
2*d*x+1/2*c)*(a-b)/((a-b)*(a+b))^(1/2))*B-1/d/(a^6-3*a^4*b^2+3*a^2*b^4-b^6)/((a-b)*(a+b))^(1/2)*arctan(tan(1/2
*d*x+1/2*c)*(a-b)/((a-b)*(a+b))^(1/2))*B*b^3

________________________________________________________________________________________

Maxima [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: ValueError} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*cos(d*x+c))/(a+b*cos(d*x+c))^4,x, algorithm="maxima")

[Out]

Exception raised: ValueError

________________________________________________________________________________________

Fricas [B]  time = 2.19025, size = 2692, normalized size = 11.36 \begin{align*} \text{result too large to display} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*cos(d*x+c))/(a+b*cos(d*x+c))^4,x, algorithm="fricas")

[Out]

[-1/12*(3*(2*A*a^6 - 4*B*a^5*b + 3*A*a^4*b^2 - B*a^3*b^3 + (2*A*a^3*b^3 - 4*B*a^2*b^4 + 3*A*a*b^5 - B*b^6)*cos
(d*x + c)^3 + 3*(2*A*a^4*b^2 - 4*B*a^3*b^3 + 3*A*a^2*b^4 - B*a*b^5)*cos(d*x + c)^2 + 3*(2*A*a^5*b - 4*B*a^4*b^
2 + 3*A*a^3*b^3 - B*a^2*b^4)*cos(d*x + c))*sqrt(-a^2 + b^2)*log((2*a*b*cos(d*x + c) + (2*a^2 - b^2)*cos(d*x +
c)^2 + 2*sqrt(-a^2 + b^2)*(a*cos(d*x + c) + b)*sin(d*x + c) - a^2 + 2*b^2)/(b^2*cos(d*x + c)^2 + 2*a*b*cos(d*x
 + c) + a^2)) - 2*(6*B*a^7 - 18*A*a^6*b + 4*B*a^5*b^2 + 23*A*a^4*b^3 - 11*B*a^3*b^4 - 7*A*a^2*b^5 + B*a*b^6 +
2*A*b^7 + (2*B*a^5*b^2 - 11*A*a^4*b^3 + 11*B*a^3*b^4 + 7*A*a^2*b^5 - 13*B*a*b^6 + 4*A*b^7)*cos(d*x + c)^2 + 3*
(2*B*a^6*b - 9*A*a^5*b^2 + 7*B*a^4*b^3 + 8*A*a^3*b^4 - 10*B*a^2*b^5 + A*a*b^6 + B*b^7)*cos(d*x + c))*sin(d*x +
 c))/((a^8*b^3 - 4*a^6*b^5 + 6*a^4*b^7 - 4*a^2*b^9 + b^11)*d*cos(d*x + c)^3 + 3*(a^9*b^2 - 4*a^7*b^4 + 6*a^5*b
^6 - 4*a^3*b^8 + a*b^10)*d*cos(d*x + c)^2 + 3*(a^10*b - 4*a^8*b^3 + 6*a^6*b^5 - 4*a^4*b^7 + a^2*b^9)*d*cos(d*x
 + c) + (a^11 - 4*a^9*b^2 + 6*a^7*b^4 - 4*a^5*b^6 + a^3*b^8)*d), 1/6*(3*(2*A*a^6 - 4*B*a^5*b + 3*A*a^4*b^2 - B
*a^3*b^3 + (2*A*a^3*b^3 - 4*B*a^2*b^4 + 3*A*a*b^5 - B*b^6)*cos(d*x + c)^3 + 3*(2*A*a^4*b^2 - 4*B*a^3*b^3 + 3*A
*a^2*b^4 - B*a*b^5)*cos(d*x + c)^2 + 3*(2*A*a^5*b - 4*B*a^4*b^2 + 3*A*a^3*b^3 - B*a^2*b^4)*cos(d*x + c))*sqrt(
a^2 - b^2)*arctan(-(a*cos(d*x + c) + b)/(sqrt(a^2 - b^2)*sin(d*x + c))) + (6*B*a^7 - 18*A*a^6*b + 4*B*a^5*b^2
+ 23*A*a^4*b^3 - 11*B*a^3*b^4 - 7*A*a^2*b^5 + B*a*b^6 + 2*A*b^7 + (2*B*a^5*b^2 - 11*A*a^4*b^3 + 11*B*a^3*b^4 +
 7*A*a^2*b^5 - 13*B*a*b^6 + 4*A*b^7)*cos(d*x + c)^2 + 3*(2*B*a^6*b - 9*A*a^5*b^2 + 7*B*a^4*b^3 + 8*A*a^3*b^4 -
 10*B*a^2*b^5 + A*a*b^6 + B*b^7)*cos(d*x + c))*sin(d*x + c))/((a^8*b^3 - 4*a^6*b^5 + 6*a^4*b^7 - 4*a^2*b^9 + b
^11)*d*cos(d*x + c)^3 + 3*(a^9*b^2 - 4*a^7*b^4 + 6*a^5*b^6 - 4*a^3*b^8 + a*b^10)*d*cos(d*x + c)^2 + 3*(a^10*b
- 4*a^8*b^3 + 6*a^6*b^5 - 4*a^4*b^7 + a^2*b^9)*d*cos(d*x + c) + (a^11 - 4*a^9*b^2 + 6*a^7*b^4 - 4*a^5*b^6 + a^
3*b^8)*d)]

________________________________________________________________________________________

Sympy [F(-1)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*cos(d*x+c))/(a+b*cos(d*x+c))**4,x)

[Out]

Timed out

________________________________________________________________________________________

Giac [B]  time = 1.56153, size = 933, normalized size = 3.94 \begin{align*} \text{result too large to display} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*cos(d*x+c))/(a+b*cos(d*x+c))^4,x, algorithm="giac")

[Out]

-1/3*(3*(2*A*a^3 - 4*B*a^2*b + 3*A*a*b^2 - B*b^3)*(pi*floor(1/2*(d*x + c)/pi + 1/2)*sgn(-2*a + 2*b) + arctan(-
(a*tan(1/2*d*x + 1/2*c) - b*tan(1/2*d*x + 1/2*c))/sqrt(a^2 - b^2)))/((a^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